import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:high_help_apps/common/widgets/common/bottom_clip.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'splash_welcome_logic.dart';
import 'splash_welcome_state.dart';

class SplashWelcomePage extends StatefulWidget {
  @override
  _SplashWelcomePageState createState() => _SplashWelcomePageState();
}

class _SplashWelcomePageState extends State<SplashWelcomePage> {
  final SplashWelcomeLogic logic = Get.put(SplashWelcomeLogic());
  final SplashWelcomeState state = Get.find<SplashWelcomeLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Stack(
        children: [
          _buildCenterSVG(),
          _buildBottomLogo()
        ],
      )
    );
  }

  Widget _buildCenterSVG() => Positioned(
    width: 250.w,
    height: 250.h,
    left: 62.5.w,
    top: 170.h,
    child: Image.asset('assets/images/splash/social_friend.png'),
  );

  Widget _buildBottomLogo() => Positioned(
    width: 250.w,
    height: 250.h,
    left: 62.5.w,
    bottom: -15.h,
    child: Center(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          SizedBox(
            width: 50.w,
            height: 50.h,
            child: Image.asset('assets/images/common/logo.png'),
          ),
          SizedBox(width: 10.w, height: 0.h),
          Text('嗨助校园', style: TextStyle(
            fontSize: 16.sp
          ),)
        ],
      ),
    ),
  );

  @override
  void dispose() {
    Get.delete<SplashWelcomeLogic>();
    super.dispose();
  }
}